#include "System.h"
void mv_process(uint8_t ucData)			 
{
		uint8_t com_data; 
		uint8_t i;
		static uint8_t RxCounter1=0;
		static uint8_t RxBuffer1[9]={0};
		static uint8_t RxState = 0;	
		static uint8_t RxFlag1 = 0;

		com_data =ucData;
	
		if(RxState==0&&com_data==0xAA)  //0xAA??
		{
			RxState=1;
			RxBuffer1[RxCounter1++]=com_data;
//			OLED_ShowString(0,0,"AA");
		}

		else if(RxState==1&&com_data==0xAE)  //0xAE??
		{
			RxState=2;
			RxBuffer1[RxCounter1++]=com_data;
//			OLED_ShowString(0,10,"bb");
		}

		else if(RxState==2)
		{
			RxBuffer1[RxCounter1++]=com_data;
//			OLED_ShowString(30,10,"A");
			if(RxCounter1>=9||com_data == 0xBA)       //RxBuffer1????,??????
			{
				RxState=3;
				RxFlag1=1;
				turn_flag=((RxBuffer1[RxCounter1-6]<<8)+RxBuffer1[RxCounter1-7]);
				center_pos=((RxBuffer1[RxCounter1-4]<<8)+RxBuffer1[RxCounter1-5]);
				center_pos=target_limit_int(center_pos,-64,64);
				angle1=RxBuffer1[RxCounter1-3];
				angle1=target_limit_int(angle1,0,50);
//				OLED_ShowString(0,64,"m");
				
			}
		}

		else if(RxState==3)		//???????????
		{
				if(RxBuffer1[RxCounter1-1] == 0xBA)
				{
							RxFlag1 = 0;
							RxCounter1 = 0;
							RxState = 0;
				}
				else   //????
				{
							RxState = 0;
							RxCounter1=0;
							for(i=0;i<10;i++)
							{
									RxBuffer1[i]=0x00;      //?????????
								  OLED_ShowString(40,0,"error");

							}
				}
		} 

		else   //????
		{
				RxState = 0;
				RxCounter1=0;
				for(i=0;i<10;i++)
				{
						RxBuffer1[i]=0x00;      //?????????
					// OLED_ShowString(40,20,"error");

				}
		}
		
}


void mv_fasong()
{



}